/**
 * Created by zyg on 16/1/7.
 */
// phantom.js 入口
require('./common/basic');
var _ = require('lodash');

var phantomCommand = require('./utils/phantomCommand');

var sys = require('system');
var executeAction = require('./actions/index');

var action = sys.args[1];

var actionArgs = sys.args.slice(2);

if(executeAction.supportActions.indexOf(action) === -1){
  log('there is no support action');
  exit();
}

var paramRegExp = /^-[\w]+$/;

var actionArgsTrans = phantomCommand.parse(actionArgs);

executeAction(action,actionArgsTrans, function (result) {
  log('cout<<',JSON.stringify(result),'<<endl;');
  exit(0);
});

//exit();